function boyWalk(){
	var container = $("#content");

	// 页面可视区域
	var visualWidth = container.width();
	var visualHeight = container.height();
	//获取数据
		var getValue = function(className){
		var $elem = $("."+className);
		return{
			height:$elem.height(),
			top:$elem.position().top
		}
	}
	var pathY = function(){
		var data = getValue("a-bag-mid");
		return data.top+data.height/2;
	}();
	var $boy = $("#boy");
	var boyHeight = $boy.height();
	$boy.css({
		"top":pathY-boyHeight+20+"px"
	});
	//修正小男孩走路
	var $boy = $("#boy");
    var boyWidth = $boy.width();
    var boyHeight = $boy.height();
    // 修正小男孩的正确位置
    $boy.css({
        top: pathY - boyHeight + 25
    });

	//恢复走路
	function restorWalk(){
		$boy.removeClass("pauseWalk");
	}
	//停止走路

	function pauseWlk(){
		$boy.addClass("pauseWalk");
	}

	//走路
	function slowWalk(){
		$boy.addClass("slowWalk");
	}

	//计算移动距离
	function calculateDist(direction, proportion){
		return (direction == "x"?visualWidth:visualHeight)*proportion;
	}


	//用transition做运动
	function startRun(options,runtime){
			var dfdPlay = $.Deferred();
			//恢复走路
			restorWalk();
			$boy.transition(
				options,
				runtime,
				'linear',
				function(){}	
			);
			return dfdPlay;

		}
	//开始走路

	function walkRun(time,dist,disY){
		time = time || 3000;
		slowWalk();
		var d1 = startRun({
			left:dist+"px",
			"top":disY?disY:undefined
		},time);
		return d1;
	}
	return{
		  walkTo: function(time, proportionX, proportionY) {
            var distX = calculateDist('x', proportionX);
            var distY = calculateDist('y', proportionY);
            return walkRun(time, distX, distY);
        },
        // 停止走路
        stopWalk: function() {
            pauseWalk();
        },
        setColoer:function(value){
            $boy.css('background-color',value);
        }
	}
}